package aiku.numericalcontroloa.Controller.EmployeeAttendance;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.EmployeeAttendance.AttendanceApplyDto;
import aiku.numericalcontroloa.Service.EmployeeAttendance.AttendanceApplyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author HuangGuangTing
 * @Date 2024/6/21 11:19
 */
@RestController
@RequestMapping("/attendanceApply")
@Slf4j
public class AttendanceApplyController {
    private final AttendanceApplyService attendanceApplyService;

    public AttendanceApplyController(AttendanceApplyService attendanceApplyService) {
        this.attendanceApplyService = attendanceApplyService;
    }

    /**
     * 添加申请
     * @param attendanceApplyDto
     * @return
     */
    @PostMapping("/addAttendanceApply")
    public Result addAttendanceApply(@RequestBody AttendanceApplyDto attendanceApplyDto){
        return attendanceApplyService.addAttendanceApply(attendanceApplyDto);
    }

    /**
     * 获取申请列表
     * @param attendanceApplyDto
     * @return
     */
    @PostMapping("/getAttendanceApplyList")
    public Result getAttendanceApplyList(@RequestBody AttendanceApplyDto attendanceApplyDto){
        return attendanceApplyService.getAttendanceApplyList(attendanceApplyDto);
    }

    /**
     * 获取单个申请记录
     * @param attendanceApplyDto
     * @return
     */
    @PostMapping("/getAttendanceApply")
    public Result getAttendanceApply(@RequestBody AttendanceApplyDto attendanceApplyDto){
        return attendanceApplyService.getAttendanceApply(attendanceApplyDto);
    }

    /**
     * 审核
     * @param attendanceApplyDto
     * @return
     */
    @PostMapping("/examineAttendanceApply")
    public Result examineAttendanceApply(@RequestBody AttendanceApplyDto attendanceApplyDto){
        return attendanceApplyService.examineAttendanceApply(attendanceApplyDto);
    }
}
